package tests;

import junit.framework.TestCase;
import lz77.CompressedData;
import lz77.util.ByteLinkedList;
import lz77.util.CharLinkedList;
import lz77.util.LinkedListNode;

public class CompressedDataTest extends TestCase {

	CompressedData cd;
	
	protected void setUp() throws Exception {
		super.setUp();
		cd = new CompressedData((char) 10);
		assertEquals(cd.getSize(),(char) 10);
	}

	public void testAdd() {
		cd.add((byte) 1);
		cd.add((char) 2);
		cd.add((byte) 3);
		cd.add((char) 4);
		
		cd.toString(); //coveragea varten
		
		LinkedListNode node = cd.head();
		
		 assertEquals(((ByteLinkedList) node).value,(byte) 1);
		 node = node.next();
		 assertEquals(((CharLinkedList) node).value,(char) 2);
		 node = node.next();
		 assertEquals(((ByteLinkedList) node).value,(byte) 3);
		 node = node.next();
		 assertEquals(((CharLinkedList) node).value,(char) 4);
		
		
	}

}
